import scala.actors.Actor
import Actor._

class Test (s:String){
  def can(a:String):String = s+"_"+a;
}

object Main {
	def main(args:Array[String]){
/*	  val myact = actor {
	    receive { 
	      case "exit" => printf("got s"); exit
	      }
	  }
	  
	  myact ! "hey"
	  
	  
	  def tm(a:(Int,Int)):Int= a match{
	      case (1,x) => x
	      case (2,_) => 2
	      case other => 0
	    }
	  
	  println(tm((1,3)));
	  println(tm((2,4)));
	  println(tm((3,3)));
	  */
	  
	  val x= new Button("Hui") with DirtyWord
	  x.click()
	  x.name="hui"
	  x.click()
	  x.click()
	  
	  val lst=List(1,3,5,7,12,18,21)
	  
	  val two:Int=2
	  
	  //lst.part
	  
	  val pat=lst.partition(i => (i /2)*2 == i )
	  println(pat)
	 
	  
	  val prod=List(1,3,5,7).reduceLeft(_ * _)
	  println(prod)
	  
	  
	  
	  
	  val tp=Tuple("x",lst)
	  
	}
}

trait DirtyWord extends Button{
  abstract override def click(){
    super.click()
    println("fk")
  }
}

trait VetoWord extends Button{
  private var count=0;
  abstract override def click(){
    if(count<1) {
      count+=1
      super.click()
      
    }
  }
}

trait Clickable{
  def click()
}

trait Subject extends Clickable{
  def what(){
    println("hi");
  }
  abstract override def click(){
    super.click()
    println("from a subject");
  }
}

class Widget{
  def draw(who:String) {
    println(who);
  }
}

class Button(var name:String) extends Widget with Clickable{
  val myname="hey"
  //var name=""
  def click(){
    draw("I'm a button named"+name)
  }
}




